package pct.manage;

import java.util.LinkedList;
import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import pct.database.PcServiceImpl;
import pct.entity.Message;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;

public class DealedSystemReportMessage extends ActionSupport implements
		SessionAware, Preparable {
	private PcServiceImpl pcService = new PcServiceImpl();
	private Map<String, Object> session;
	public String execute()
	{
		StatusManager sm=(StatusManager) session.get("status");
		pcService.dealedReportMessage(sm.getCurrentUser().getUsername());
		LinkedList<Message> systemReportMessage=new LinkedList<Message>();
		systemReportMessage=pcService.getSystemReportMessage(sm.getCurrentUser().getUsername());
		session.put("systemReportMessage", systemReportMessage);
		return SUCCESS;
	}
	
	public void prepare() throws Exception {
		pcService.connectDB();
	}

	@Override
	public void setSession(Map<String, Object> arg0) {
		this.session = arg0;

	}

}
